<%--
  Created by IntelliJ IDEA.
  User: shen
  Date: 2020/5/11
  Time: 16:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta  content="width=device-width, initial-scale=1">
    <title>错题本</title>
   <%-- <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">--%>
    <%@include file="../common_resource.jsp" %>
    <style type="text/css">
        .main_body{
            /*position: relative;
            top:190px;*/
            font-size: 14px;
        }
        .table{
            font-size: 14px;
        }
    </style>
    <script>


        function to(){
            location.href="views/question/single_input.jsp";
        }
        function checkAll(){
            var box=document.getElementsByName("selectID");
            var chkall=document.getElementById("checkall");
            if(chkall.checked){
                for(var i=0;i<box.length;i++){
                    box[i].checked=true;
                }
            }else{
                for(var i=0;i<box.length;i++){
                    box[i].checked=false;
                }
            }
        }
        function detail(id){
            var o = document.getElementById("option"+id);
            if (o){
                if (o.style.display == "none"){ o.style.display = "block"; } else {o.style.display = "none";}
            }


            $.get("question/selectQuestionById.do",{"id":id},function(json){
                $.each(json, function(i,item){
                    $("#optionA"+id).html(item.optionA);
                    $("#optionB"+id).html(item.optionB);
                    $("#optionC"+id).html(item.optionC);
                    $("#optionD"+id).html(item.optionD);
                });

            });
        }


        function collapseExpand(ss){
            $(ss).style.display = "block";
        }


        function openOption(){
            var obj=document.getElementsByName('selectID');
            for(var i=0; i<obj.length; i++){
                var id=obj[i].value;
                $.get("question/selectQuestionById.do",{"id":id},function(json){
                    $.each(json, function(i,item){
                        $("#optionA"+item.questionId).html(item.optionA);
                        $("#optionB"+item.questionId).html(item.optionB);
                        $("#optionC"+item.questionId).html(item.optionC);
                        $("#optionD"+item.questionId).html(item.optionD);
                        $("#optionE"+item.questionId).html(item.optionE);
                    });
                });
                var o = document.getElementById("option"+id);
                if (o){
                    if (o.style.display == "none"){ o.style.display = "block";$("#openlog").html("[-]"); } else {o.style.display = "none"; $("#openlog").html("[+]");}
                }
            }

        }
        $(function(){
            <c:if test="${not empty updateRdiolag and updateRdiolag}">
            $("#successModal").modal();
            </c:if>

            <c:if test="${not empty updateRdiolag and (not updateRdiolag)}">
            $("#feildModal").modal();
            </c:if>

            <c:if test="${not empty savaRdiolag and savaRdiolag}">
            $("#insertSuccessModal").modal();
            </c:if>

            <c:if test="${not empty savaRdiolag and (not savaRdiolag)}">
            $("#insertFailModal").modal();
            </c:if>
        });
    </script>

</head>
<body class="main_body">
<div class="container container-1180" >
    <div class="col" style="margin-top: 10px;">
        <div class="panel panel-info">
            <div class="panel-heading">
                <span ><i class="fa fa-user"></i></span> <label><font style="font-weight: bold;margin-left: 10px;">查看错题</font></label>
                <label style="float: right;">

                </label>
            </div>
            <form id="searchForm" name="searchForm" role="form"   action="testPaper/test" method="post">
                <!-- 试题类型 -->
                <!-- 查询 -->
                <input type="hidden" name="coll_exp" value="0" />
                <table border="0" width="100%" >

                    <tr>
                        <td >
                            <!-- 列表 -->
                            <div class="listDiv" id="allExam">
                                <%--设置变量--%>
                                <c:set var="index" value="${1}"/>
                                <c:if test="${sessionScope.sdErrorByIdList[0] ne null}">
                                <label style="color: black;">单选题：&nbsp;</label>
                                </c:if>

                                <%--单选题--%>
                                <c:forEach var="sQlist" items="${sessionScope.sdErrorByIdList}"  varStatus="status" begin="0" step="1">
                                <c:if test="${sQlist.sdfsQuestions.questionType ==1}">
                                <div id="question${sQlist.sQuestion.sQuestionID }" class="panel panel-info sExamList" style="font-size: 13px;">
                                    <div class="paner-body panel-heading" >
                                        <label style="color: black;">&nbsp;</label>
                                        <a id="mir" onclick="delErrorQuestion('${sQlist.examNo}','${sQlist.sQuestion.sQuestionID}')">
                                            <span id="sctxt${sQlist.sQuestion.sQuestionID}"  class="glyphicon glyphicon-star" style="padding: 0px"></span><i class="iconfont icon-favorite"></i>
                                        </a>
                                            ${index}.<a href="javascript:detail(${sQlist.sQuestion.sQuestionID });">${sQlist.sdfsQuestions.question}(${sQlist.value}分)</a>

                                    </div>
                                    <div id="option${sQlist.sQuestion.sQuestionID}" class="radio_list_options panel-collapse collapse" style="display: inline-block">
                                        <ul style="margin-left:7px;">
                                            <li><span id="optionA${sQlist.sQuestion.sQuestionID}">${sQlist.sQuestion.optionA}</span></li>
                                            <li><span id="optionB${sQlist.sQuestion.sQuestionID}">${sQlist.sQuestion.optionB}</span></li>
                                            <li><span id="optionC${sQlist.sQuestion.sQuestionID}">${sQlist.sQuestion.optionC}</span></li>
                                            <li><span id="optionD${sQlist.sQuestion.sQuestionID}">${sQlist.sQuestion.optionD}</span></li>
                                            <c:if test="${not empty sQlist.sQuestion.optionE}">
                                                <li><span id="optionE${sQlist.sQuestion.sQuestionID}">${sQlist.sQuestion.optionE}</span></li>
                                            </c:if>

                                        </ul>

                                        <span class="answer1" style="color:red;font-size: 15px;font-weight: bold">参考答案：${sQlist.sQuestion.sCorrect } &nbsp;&nbsp;&nbsp;你的答案：${sQlist.sdAnswer}&nbsp;&nbsp;&nbsp; 得分：${sQlist.sdScore}

                                    </div>
                                </div>
                                <div style="height: 10px"></div>
                                        <c:set var="index" value="${index+1}"/>

                                </c:if>

                                </c:forEach>


                                    <c:if test="${sessionScope.sdErrorByIdList[0] ne null}">
                                    <label style="color: black;">判断题：&nbsp;</label>
                                    </c:if>
                                    <%--设置变量--%>
                                    <c:set var="index" value="${1}"/>
                                <%--判断题--%>
                                <c:forEach var="dQlist" items="${sessionScope.sdErrorByIdList}" varStatus="status">
                                    <c:if test="${dQlist.sdfsQuestions.questionType == 2}">
                                <div id="question${dQlist.dQuestion.dQuestionID }" class="panel panel-info dExamList" style="font-size: 13px;">
                                    <div class="paner-body panel-heading">
                                        <label style="color: black;">&nbsp;</label>
                                        <a id="mir" onclick="delErrorQuestion('${dQlist.examNo}','${dQlist.dQuestion.dQuestionID}')">
                                            <span id="sctxt${dQlist.dQuestion.dQuestionID}"  class="glyphicon glyphicon-star" style="padding: 0px"></span><i class="iconfont icon-favorite"></i>
                                        </a>
                                            ${index}.<a href="javascript:detail(${dQlist.dQuestion.dQuestionID });">${dQlist.sdfsQuestions.question }(2分)</a>
                                    </div>
                                    <div id="option${dQlist.dQuestion.dQuestionID}" class=" panel-collapse collapse" style="display: inline-block">
                                        <ul style="margin-left:7px; list-style: none" >
                                            <li><input type="radio" name="dCorrect" id="T${dQlist.dQuestion.dQuestionID}"  <c:if test="${T eq dQlist.dQuestion.dCorrect}"></c:if> >T</li>
                                            <li><input type="radio" name="dCorrect" id="F${dQlist.dQuestion.dQuestionID}" <c:if test="${F eq dQlist.dQuestion.dCorrect}"></c:if> >F</li>
                                        </ul>

                                        <input type="hidden" name="fCorrect" value="${dQlist.dQuestion.dCorrect}">
                                        <span class="answer1" style="color:red;font-size: 15px;font-weight: bold">参考答案：${dQlist.dQuestion.dCorrect } &nbsp;&nbsp;&nbsp;你的答案：${dQlist.sdAnswer}&nbsp;&nbsp;&nbsp; 得分：${dQlist.sdScore}</span>

                                    </div>

                                </div>
                                        <c:set var="index" value="${index+1}"/>

                                </c:if>
                                    <div style="height: 10px"></div>
                                </c:forEach>

                                    <%--设置变量--%>
                                    <c:set var="index" value="${1}"/>
                                    <c:if test="${sessionScope.fsErrorByIdList[0] ne null}">
                                    <label style="color: black;">填空题：&nbsp;</label>
                                    </c:if>
                                <%--填空题--%>
                                <c:forEach var="fQlist" items="${sessionScope.fsErrorByIdList}" varStatus="status">
                                <c:if test="${fQlist.sdfsQuestions.questionType ==3}">
                                <div id="question${fQlist.fQuestion.fQuestionID}" class="panel panel-info fExamList" style="font-size: 15px;">
                                    <div class="paner-body panel-heading">
                                        <label style="color: black;">&nbsp;</label>
                                        <a id="mir" onclick="delErrorQuestion('${fQlist.examNo}','${fQlist.fQuestion.fQuestionID}')">
                                            <span id="sctxt${fQlist.fQuestion.fQuestionID}"  class="glyphicon glyphicon-star" style="padding: 0px"></span><i class="iconfont icon-favorite"></i>
                                        </a>
                                            ${index}.<a  id="questionBody" href="javascript:detail(${fQlist.fQuestion.fQuestionID});">${fQlist.sdfsQuestions.question}(${fQlist.totalValue}分)
                                    </a>

                                    </div>
                                    <div id="option${fQlist.fQuestion.fQuestionID}" class="file-list panel-collapse collapse" style="display: inline-block">

                                        <input type="hidden" name="fCorrect" value="${fQlist.fQuestion.fCorrect}">
                                    </div>
                                    <p style="color: red;font-size: 15px;font-weight: bold">参考答案：</p>
                                    <span id="questionBody" class="answer1"style="color:red;font-size: 15px">${fQlist.fQuestion.fCorrect}  </span><br/><br/>
                                    <p style="color: red;font-size: 15px;font-weight: bold">你的答案：</p>
                                    <span id="questionBody" class="answer1"style="color:red;font-size: 15px">${fQlist.fsAnswer}</span><br/>
                                    <c:if test="${fQlist.fsImages ne null}">
                                        <img id="images" src="${fQlist.fsImages}">
                                    </c:if>
                                    <br/><p style="color: red;font-size: 15px;font-weight: bold">得分：</p>
                                    <span class="answer1" style="color:red;font-size: 15px">${fQlist.fsScore}</span>

                                </div>

                                    <div style="height: 10px"></div>
                                        <c:set var="index" value="${index+1}"/>
                                </c:if>
                                    <div style="height: 10px"></div>
                                </c:forEach>

                                    <%--设置变量--%>
                                    <c:set var="index" value="${1}"/>
                                    <c:if test="${sessionScope.fsErrorByIdList[0] ne null}">
                                    <label style="color: black;">简答综合题：&nbsp;</label>
                                    </c:if>
                                <%--简答综合题--%>
                                <c:forEach var="shQlist" items="${sessionScope.fsErrorByIdList}" >
                                        <c:if test="${shQlist.sdfsQuestions.questionType ==4 or shQlist.sdfsQuestions.questionType ==5}">
                                    <div id="question${shQlist.shQuestion.shQuestionID }" class="panel panel-info shExamList" style="font-size: 15px;">
                                    <div class="paner-body panel-heading" >
                                        <label style="color: black;">&nbsp;</label>
                                        <a id="mir" onclick="delErrorQuestion('${shQlist.examNo}','${shQlist.shQuestion.shQuestionID}')">
                                            <span id="sctxt${shQlist.shQuestion.shQuestionID}"  class="glyphicon glyphicon-star" style="padding: 0px"></span><i class="iconfont icon-favorite"></i>
                                        </a>
                                        ${index}.<a id="questionBody" href="javascript:detail(${shQlist.shQuestion.shQuestionID});">${shQlist.sdfsQuestions.question}(${shQlist.totalValue}分)</a>
                                        <c:if test="${shQlist.shQuestion.shQuestionImage ne null}">
                                            <img id="images" src="images/upload/${shQlist.shQuestion.shQuestionImage}">
                                        </c:if>
                                    </div>
                                    <br/>
                                        <p style="color: red;font-size: 15px;font-weight: bold">参考答案：</p>
                                        <span id="questionBody" class="answer1"style="color:red;font-size: 15px">${shQlist.shQuestion.shCorrect} </span><br/><br/>
                                        <p style="color: red;font-size: 15px;font-weight: bold">你的答案：</p>
                                        <span id="questionBody" class="answer1"style="color:red;font-size: 15px">${shQlist.fsAnswer}</span><br/>
                                        <c:if test="${shQlist.fsImages ne null}">
                                            <img  alt="" src="${shQlist.fsImages}">
                                        </c:if>
                                        <br/><p style="color: red;font-size: 15px;font-weight: bold">得分：</p>
                                        <span class="answer1" style="color:red;font-size: 15px">${shQlist.fsScore}</span>

                                    </div>

                                    <div style="height: 10px"></div>

                                    <c:set var="index" value="${index+1}"/>
                                    </c:if>
                                </c:forEach>
                                <c:remove var="index"></c:remove>
                        </td>
                    </tr>
                </table>

            </form>
        </div>
    </div>
</div>


<%--<script src="../bootstrap/plugins/transition.js"></script>
<script src="../bootstrap/plugins/modal.js"></script>
<script src="bootstrap/plugins/tooltip.js"></script>
<script src="bootstrap/plugins/popover.js"></script>
<script src="bootstrap/plugins/collapse.js"></script>--%>
<%--
<script src="bootstrap/js/jquery.editable-select.min.js"></script>
--%>
<script src="../../js/jquery-2.0.0.js"></script>
<script src="../../bootstrap/js/bootstrap.js"></script>

<script>

    //收藏操作 按钮被点击时执行
    function delErrorQuestion(examNo,qId) {
        var text = $("#sctxt" + qId);
        var classText = $(text).attr("class");
        console.log(text)
        console.log(classText)
        console.log(examNo)

        /*$.ajax({
            type: "post",
            dataType: "json",
            url: 'error/deleteErrorQuestion',
            data: {examNo:  examNo,qId: qId},
            success: function (deleteErrorQuestion) {
                console.log("成功")
                if(deleteErrorQuestion=="1"){
                    location.reload();
                    console.log("成功")
                }
            },
            error:function () {
                alert("error,取消收藏失败");
            }

        });*/
        $.post( 'error/deleteErrorQuestion',{examNo:  examNo,qId: qId}, function(res){
                //alert(res.selectExam)
                if(res.deleteErrorQuestion==1){
                    console.log($("#question"+qId))
                    $("#question"+qId).remove();
                    location.href="error/selectErrorQByUserId/${sessionScope.loginUser.sstsUserID}";
                    console.log(123)
                }else {
                    alert("error,取消收藏失败");
                }
            })
        }
</script>
</body>
</html>


